<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<html>
<head>
<title>合格证补录</title>
	<script src="${contextPath}/scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
	<script src="${contextPath}/scripts/scriptvalidator.js" type="text/javascript"></script>
	<script src="${contextPath}/scripts/common.js" type="text/javascript"></script>
	<link href="${contextPath}/styles/default.css" rel="stylesheet" type="text/css" />
	<script src="${contextPath}/scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
	<script language='javascript'>
	function checkSubmit(){
	 	var staffForm = document.form1;
		if(!Validator.Validate(staffForm, 3)) {
			return false;
		}
			return this.duibi();
		
	 }
 
 
 
function doAjaxTest(i){
	if(i != null){
		var select=document.getElementById("select");
	    select.length=0;
		$.ajax({
			  async:false,
			  type: 'POST',
			  url:"<s:property value='contextPath'/>/cm/shopFinal.do?shopIdLong="+i,
			  dataType: "json",
			  success: function(data) {
				  if(data !=null){
					  var obj=document.getElementById("select");
					  obj.options.length=0;
					  var a=new Array();
					  var b=new Array();  
					  a = data.toString().split(",");
					  for(var i=0;i<a.length;i++){
						  b = a[i].split(":");
						  obj.options.add(new Option(b[1],b[0]));
					  }
				  }
				  
			  }
			});
	}
	
}
function doAjaxBrandTest(i){
	if(i != null){
		var select=document.getElementById("brandSelect");
	    select.length=0;
		$.ajax({
			  async:false,
			  type: 'POST',
			  url:"<s:property value='contextPath'/>/cm/detailsBrand.do?shopIdLong="+i,
			  dataType: "json",
			  success: function(data) {
				  if(data !=null){
					  var obj=document.getElementById("brandSelect");
					  obj.options.length=0;
					  var a=new Array();
					  var b=new Array();  
					  a = data.toString().split(",");
					  for(var i=0;i<a.length;i++){
						  b = a[i].split(":");
						  obj.options.add(new Option(b[1],b[0]));
					  }
				  }
				  
			  }
			});
	}
	
}
function lonad(obj){
	var shopID = document.getElementById("shopId").value;
	if(shopID != null && shopID != ""){
		doAjaxTest(shopID);
		doAjaxBrandTest(shopID);	
	}else if(obj != ""){
		doAjaxTest(obj);
		doAjaxBrandTest(obj);	
	}
}
function duibi() {
	var a=document.getElementById("dateBeg").value;
	var b=document.getElementById("dateEnd").value;
	if(null != a && null != b){
		var arr = a.split("-");
	    var starttime = new Date(arr[0], arr[1], arr[2]);
	    var starttimes = starttime.getTime();

	    var arrs = b.split("-");
	    var lktime = new Date(arrs[0], arrs[1], arrs[2]);
	    var lktimes = lktime.getTime();

	    if (starttimes >= lktimes) {
	    	document.getElementById('iDBody1').style.display = "";
	        return false;
	    }
	    else{
	    	document.getElementById('iDBody1').style.display = "none";
	    	return true;
	    }
	}else{
		return true;
	}
}
</script>
</head>
<body onLoad="lonad(${shop.id})">
<div class="navigation">
	    <span><a href="javascript:window.history.back();"><img src="${contextPath}/images/back_nav_btn.png" /></a>
	    <a href="javascript:window.history.back();">返回</a>
	    <a href="javascript:window.history.forward();"><img src="${contextPath}/images/go_nav_btn.png" /></a>
	     <a href="javascript:window.history.forward();">前进</a>
	    <a href="javascript:window.location.reload();"><img src="${contextPath}/images/refresh_nav_btn.png" /></a>
	     <a href="javascript:window.location.reload();">刷新</a>
	    </span>合格证管理&gt;&gt;合格证补录
    </div>
<div class="xt_main_right_center">
<form name="form1" id="form1" onSubmit="return checkSubmit();" method="post" action="addTwo.do">
<input type="hidden" name="redirectUrl" value='<s:property value='redirectUrl'/>'/>
<input type="hidden" name="id" value="${id }"/>
<div>
  <table width="100%" border="0" align="center" cellpadding="1" cellspacing="2">
    <tr>
      <td class="left-td-width-bg"  align="right"><font  color="red" size="2">* </font>4S店：</td>
      <td class="right-td-width-bg-left"><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="90%">
            <input  datatype="Require" msg="请选择4S店"  class="input_readonly"  name="textfield2" value="${shop.shopName }" type="text" id="aaa" readonly="readonly" />
             <input type="hidden" value="${shop.id }" id="shopId" name="shopId" />
            </td>
         
        </tr>
      </table>
        <input type="hidden" id="textfield" />
        <input type="hidden" value="${cerF.id }" id="cerF.id" name="cerF.id" /></td>
      <td class="left-td-width-bg"  align="right"><font  color="red" size="2">* </font>金融机构：</td>
      <td class="right-td-width-bg-left"><label>
        <select  datatype="Require" msg="请选择金融机构"  class="select" name="financial.id" id="select">
        </select>
      </label></td>
    </tr>
      <tr>
    <td class="left-td-width-bg"  align="right">
      <font  color="red" size="2">* </font>渠道：
      </td>
      <td class="right-td-width-bg-left" > <div id="tt"></div>
	<select dataType="Require" msg="请选择渠道 "  class="select" name="cerF.brand.id" id="brandSelect"> </select></td>
      <td class="left-td-width-bg"  align="right">货款品种号：</td>
      <td class="right-td-width-bg-left"><input class="input"  type="text" value="${cerF.draft }" name="cerF.draft" id="textfield13"></td>
    </tr>
    <tr>
      <td class="left-td-width-bg"  align="right">车型：</td>
      <td class="right-td-width-bg-left"><input class="input"  type="text" value="${cerF.motorcycleType }" name="cerF.motorcycleType" id="textfield3"></td>
      <td class="left-td-width-bg"  align="right">订单号：</td>
      <td class="right-td-width-bg-left"><input class="input"  type="text" value="${cerF.orderNumber }" name="cerF.orderNumber" id="textfield12"></td>
    </tr>
    <tr>
<!--     	这里的唯一验证没实际意义 -->
      <td class="left-td-width-bg"  align="right"><font  color="red" size="2">* </font>车架号：</td>
      <td class="right-td-width-bg-left"><input class="input"  type="text" maxLength="17"  value="${cerF.chassis}" name="cerF.chassis" id="textfield4" dataType="Require|Chassis"  msg="车架号不能为空|车架号验证  能为数字或字母 长度为十七|当前批量申请单或者其它申请单存在相同车架号" classType="com.jysz.certificate.persistence.model.cm.applyAdd.ApplyCerList" valProperty="chassis" ignoreCase="true" entityId="${cerF.id}"  contextPath="${contextPath}"></td>
       <td class="left-td-width-bg"  align="right">货款起始日：</td>
      <td class="right-td-width-bg-left"><input id="dateBeg" class="Wdate" onBlur="duibi()" type="text" value="<s:date name="cerF.draftBeginDate" format="yyyy-MM-dd"/>" name="cerF.draftBeginDate" winth="200px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true"/></td>
    </tr>
    <tr>
     <td class="left-td-width-bg"  align="right">
<%-- 	     <s:if test="@com.jysz.certificate.persistence.enums.PostType@Shop.equals(user.post)">	</s:if> --%>
	     <font  color="red" size="2">* </font>合格证号：
	  </td>
     
      <td class="right-td-width-bg-left">
      <s:if test="@com.jysz.certificate.persistence.enums.PostType@Shop.equals(user.post)">
      	<input class="input" maxLength="15" type="text" name="cerF.certificationNum" id="textfield5" dataType="Require|certificationNum"  msg="合格证号不能为空|合格证号必须为15位|当前批量申请单或者其它申请单存在相同合格证号" classType="com.jysz.certificate.persistence.model.cm.applyAdd.ApplyCerList" ignoreCase="true" valProperty="certificationNum" entityId="${cerF.id}" contextPath="${contextPath}"/>
      </s:if>
      <s:else>
      	<input class="input" maxLength="15" type="text" name="cerF.certificationNum" id="textfield5" dataType="Require|certificationNum"  msg="合格证号不能为空|合格证号必须为15位|当前批量申请单或者其它申请单存在相同合格证号" classType="com.jysz.certificate.persistence.model.cm.applyAdd.ApplyCerList" valProperty="certificationNum" ignoreCase="true" entityId="${cerF.id}" contextPath="${contextPath}"/>
      </s:else></td>
     <td class="left-td-width-bg"  align="right">货款到期日：</td>
      <td class="right-td-width-bg-left"><input id="dateEnd" class="Wdate" onBlur="duibi()" type="text" value="<s:date name="cerF.draftEndDate" format="yyyy-MM-dd"/>" name="cerF.draftEndDate" winth="200px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true"/>
      <div id="iDBody1" style="display:none"><font  color="red" size="2">起始时间大于到期时间，请检查</font></div>
      </td>
    </tr>
    <tr>
      <td class="left-td-width-bg"  align="right">发动机号：</td>
      <td class="right-td-width-bg-left"><input class="input"  type="text" value="${cerF.engine }" name="cerF.engine" id="textfield6"></td>
      <td class="left-td-width-bg"  align="right"><font  color="red" size="1">(中资银行必须录入)</font>供货价：</td>
      <td class="right-td-width-bg-left"><input msg="供货价格式错误(最大到千万位)" dataType="DoubleMoney"  class="input"  type="text" value="${cerF.supplyPrice }" name="cerF.supplyPrice" id="textfield7"style="text-align:right"></td>
    </tr>
    <tr>
      <td class="left-td-width-bg"  align="right"><font  color="red" size="2">* </font>补录日期：</td>
      <td class="right-td-width-bg-left">
      <input dataType="Require" msg="请选择补录日期 " id="buluDate" class="Wdate" type="text" value="<s:date name="cerF.bulvDate" format="yyyy-MM-dd"/>" name="cerF.bulvDate" winth="200px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true"/></td>
      <td class="left-td-width-bg"  align="right"><font  color="red" size="2">* </font>预计到店日：</td>
      <td class="right-td-width-bg-left">
      <input dataType="Require" msg="请选择预计到店日 " id="buluDate" class="Wdate" type="text" value="<s:date name="cerF.scheduledDate" format="yyyy-MM-dd"/>" name="cerF.scheduledDate" winth="200px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true"/></td>
    </tr>
    <tr>
      <td colspan="4" align="center"><label>
        <input type="submit"  onclick="javascript:cao();"  class="btn_save" name="button2" id="button2" value="" />
        <input type="button" name="button2" class="btn_rest" onclick="clearForm(this.form);return false;" />
      </label></td>
    </tr>
  </table>
</div>
</form>
</div>
<br/><br/><br/><br/><br/>
		<div><jsp:include page="/include/footer.inc"></jsp:include></div>
</body>
</html>